var list = [
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" },
  { time: "2015-12-08", res: "全天无记录", resDesc: "因为外出出差" }
];
var tableStr = "";
var tableConDom = document.getElementsByClassName("table-con")[0];
for (var i = 0; i < list.length; i++) {
  tableStr +=
    '<div class="table-item"><span class="table-span">2020-01-01</span><span class="table-span">全天无记录</span><span class="table-span last-table-span"><textarea class="textarea" disabled>在w3school，你可以找到你所需要的所有的网站建设教程。</textarea></span></div>';
}
tableConDom.innerHTML = tableStr;

var editBtn = document.getElementsByClassName("edit-btn")[0];
var cancelBtn = document.getElementsByClassName("btn-default")[0];
var noEditBtn = document.getElementsByClassName("no-edit-btn")[0];
var saveBtn = document.getElementsByClassName("save")[0];
var textareaList = document.getElementsByClassName("textarea");
editBtn.onclick = function() {
  toggle("none", "block", false);
};
saveBtn.onclick = function() {
  toggle("block", "none", true);
};
cancelBtn.onclick = function() {
  toggle("block", "none", true);
};
function toggle(a, b, c) {
  editBtn.style.display = a;
  noEditBtn.style.display = b;
  for (var i = 0; i < textareaList.length; i++) {
    textareaList[i].disabled = c;
  }
}
